#define _CRT_SECURE_NO_WARNINGS 1


double average(int* salary, int salarySize) 
{
    double max = 0;
    double min = salary[0];
    double ret = 0;
    for (int i = 0; i < salarySize; i++)
    {
        if (max < salary[i])
            max = salary[i];
        if (min > salary[i])
            min = salary[i];
        ret += salary[i];
    }
    ret -= max + min;
    return ret / (salarySize - 2);
}